﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MengLin.OOP.DesignPattern.CompsitePattern.RoleReward
{
    /// <summary>
    /// 具体的角色
    /// </summary>
    public class RoleLeaf: AbstractRole
    {
        /// <summary>
        /// 计算分红
        /// </summary>
        /// <param name="total"></param>
        public override void CalculateDividend(double totalMoney)
        {
            double result = totalMoney * this.Percent / 100;
            Console.WriteLine("this {0} 分红 {1}", this.Name, result);
        }

        /// <summary>
        /// 增加子节点
        /// 叶子节点不能增加子节点
        /// 透明模式
        /// </summary>
        /// <param name="roleChild"></param>
        public override void AddChild(AbstractRole roleChild)
        {
            throw new Exception("这里不能AddChild");
        }
    }
}
